package com.diandi.signature.service.impl.signaturepkg;

import com.diandi.signature.bean.pkgmsg.SignatureBusinessPkgmsg;
import com.diandi.signature.bean.proceessinfo.SignaturePkgMsg;
import com.diandi.signature.manager.signaturepkg.SignaturePkgMsgManager;
import com.diandi.signature.signaturepkg.SignaturePkgMsgService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by mxp on 2017/8/31.
 */
@Service
public class SignaturePkgMsgServiceImpl implements SignaturePkgMsgService {

    @Autowired
    private SignaturePkgMsgManager signaturePkgMsgManager;

    @Override
    public Integer savePkgMsg(String userId, String tradeNo, String passCode, String merchantNo, String interfactType, String requestMsg, int status, String pkgmsgType) {
        return signaturePkgMsgManager.savePkgMsg(userId, tradeNo, passCode, merchantNo, interfactType, requestMsg, status, pkgmsgType);
    }

    @Override
    public Integer updatePkgMsg(String returnMsg, String tradeNo, String userId, String passCode, int status) {
        return signaturePkgMsgManager.updatePkgMsg(returnMsg, tradeNo, userId, passCode, status);
    }

    @Override
    public SignatureBusinessPkgmsg getSignaturePkgMsg(String tradeNo) {

        if (StringUtils.isBlank(tradeNo)){
            return null;
        }

        Map<String, String> paramMap = new HashMap<String, String>();
        paramMap.put("tradeNo", tradeNo);

        return signaturePkgMsgManager.getSignaturePkgMsg(paramMap);
    }
}
